Conventionally, an electronic control unit (i.e., an ECU in the following description) disposed in a vehicle and controlling each part of the vehicle determines whether there is a trouble in predetermined detection objects in a vehicle as required, and stores a trouble code that represents the trouble in a semiconductor memory (e.g., an SRAM, or an EEPROM) in the ECU.
Patent documents such as JP-A-2006-286111 and JP-A-2005-196515 disclose a memory management scheme using a semiconductor memory for storage of the trouble code equipped with detection functions that detect a write-error in the memory, a garbaged data in the memory, a physical error of the memory itself and the like.
When, for example, the storage of the semiconductor memory is divided into three areas, the same data is written in each of the three divided areas for detecting errors (i.e., memory error) based on a majority ruling of the data in those areas. More practically, when at least data from two areas do not agree with each other, that is, when data in three areas are respectively different, the memory is determined to have a trouble, according to the above disclosure.
When the majority ruling is performed for the data in the three memory areas in the semiconductor memory, there are two types of ruling. That is, in one case, the data is ruled by the address, that is, by a unit of bytes, or data as a whole (refer to the document JP-A-2005-196515), or in another case, the data is ruled bit by bit in the data (refer to a patent document JP-A-2001-67272).
The above cases are explained with reference to the drawing First, the majority ruling by a unit of bit is explained referring to FIGS. 9A and 9B. It is assumed that the trouble code to be memorized is 0x0118 in this case. In addition, in the data 0x0118, four digits of the latter half is a substantial part for representing a predetermined data (i.e., the trouble code) in hexadecimal. The two digits in front designate a code that indicates that the latter four digits are represented in hexadecimal. The actually stored data is the data represented by a binary code, and has a data amount of two bites. Further, the three memory areas area distinguished as the first, second and third areas in the following description.
In FIG. 9A, data “0000 0001 0001 1000” that represents 0x0118 in a binary code is memorized in the first area. The same data is stored in the second area. The data in the third area has abnormality such as a garbaged 13th bit or the like, and data “0000 0001 0001 0000” is stored.
In this case, the data at the thirteenth bit is recognized as “1” by the majority ruling using a unit of bit. In other words, by the majority ruling, the trouble code is determined as “0000 0001 0001 1000” (0x0118).
In FIG. 9B, the first area stores data “0000 0001 1001 1001” (0x0199) and, the second area stores data “0000 0000 0001 0000” (0x0010), and the third area stores data “0000 0011 0100 1010” (0x034A). In this case, when the majority ruling is applied bit by bit from the first bit of the data, the trouble code provided by the majority ruling becomes data “0000 0001 0001 1000” (0x0118). In other words, a trouble code (0x0118:“0000 0001 0001 1000”) is accidentally derived from the majority ruling even when the three areas respectively store data that is different from the intended trouble code (0x0118:“0000 0001 0001 1000”).
In view of the above case, the majority ruling by a unit of byte may seem to be more desirable.
The majority ruling by a unit of byte is explained with reference to FIGS. 10A and 10B. In FIG. 10A, data “0000 0001 0001 1000” that represents 0x0118 in a binary code is memorized in the first area. The second area stores the same data. The data in the third area has abnormality such as a garbaged 13th bit or the like, and data “0000 0001 0001 0000” (0x0110) is stored.
In this case, when the majority ruling is performed by a unit of byte (i.e., 2 byte data as a whole), data in the first are “0000 0001 0001 1000” (0x0118), data in the second area “0000 0001 0001 1000” (0x0118), and data in the third area “0000 0001 0001 0000” (0x0110) are used in the ruling. In this case, the majority ruling yields data “0000 0001 0001 1000” (0x0118) because the data (i.e., the trouble code) in the first and second areas agrees with each other.
In FIG. 10B, data “0000 0001 1001 1001” (0x0199) is memorized in the first area, data “0000 0000 0001 0000” (0x0010) is memorized in the second area, and data “0000 0011 0100 1010” (0x034A) is memorized in the third area.
In this case, the data in the first are “0000 0001 1001 1001” (0x0199), the data in the second area “0000 0000 0001 0000” (0x0010), and the data in the third area “0000 0011 0100 1010” (0x034A) will be used by the majority ruling by a unit of byte, and the ruling does not find majority to result in determination of the abnormality because the three areas have respectively different data.
As apparently illustrated in the comparison between FIG. 9B and FIG. 10B, the majority ruling by a unit of bit may be more prone to error in the detection of abnormality relative to the majority ruling by a unit of byte.
Further, even when the majority ruling by a unit of byte is used, another type of problem persists.
For example, due to an interruption of a power supply during a write operation in the second area, the data is not written in the second area and data in three areas may become mutually different from each other. In that case, the operation is determined as abnormality. That is, in other words, the abnormality is detected even when the semiconductor memory does not have any problem, and a chance of restoration of reliable data goes abandoned.